from django.test import TestCase

# Create your tests here.
<<<<<<< HEAD
=======
import sys
import os
import csv
import json

pwd = os.path.dirname(os.path.realpath(__file__))
sys.path.append(pwd + "../")

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BasketballCommunity.settings")

import django

django.setup()

from users.models import UserProfile
from good_article.models import GoodCategory, GoodArticle

user = UserProfile.objects.all()[0]
cate = GoodCategory.objects.get(pk=2)
with open('data/run.csv', 'r', encoding='gbk', errors='ignore') as f:
    content = csv.reader(f)
    for con in content:
        print(con)
        good = GoodArticle()
        good.title = con[0][2:-1]
        good.image = con[3][2:-1]
        good.content = con[4][1:-1]
        good.category = cate
        good.author = user
        good.save()
>>>>>>> d52c813f64de94aad061f95fa8c88c3c5d5bf7b2
